package enums;

import lombok.Getter;

/**
 * @author jesse
 * @Date 2019/5/24 15:50
 * @Version 1.0
 */
@Getter
public enum  SysInfoEnum {
    /**
     * 错误提示
     */
    ERROR(0,"错误"),

    /**
     * 成功提示
     */
    SUCCESS(1,"成功"),

    REPEAT_LOGIN(2,"重复登录"),

    ID_NULL(3,"id为空"),

    LOG_STUINFO_ERROR(4,"录入学生信息错误"),

    LOG_STUINFO_SUCCESS(5,"录入学生信息成功"),

    EDIT_STUINFO_ERROR(6,"编辑学生信息错误"),

    EDIT_STUINFO_SUCCESS(7,"编辑学生信息成功"),

    LOG_SYSM_ERROR(8,"录入管理员信息错误"),

    LOG_SYSM_SUCCESS(9,"录入管理员信息成功"),

    EDIT_SYSM_ERROR(10,"编辑管理员信息错误"),

    EDIT_SYSM_SUCCESS(11,"编辑管理员信息成功"),

    LOG_STUSCOREM_ERROR(12,"录入成绩信息错误"),

    LOG_STUSCOREM_SUCCESS(13,"录入成绩信息成功"),

    EDIT_STUSCOREM_ERROR(14,"编辑成绩信息错误"),

    EDIT_STUSCOREM_SUCCESS(15,"编辑成绩信息成功"),

    LOG_PAY_ERROR(16,"录入学生缴费信息错误"),

    LOG_PAY_SUCCESS(17,"录入学生缴费信息成功"),

    EDIT_PAY_ERROR(18,"编辑学生缴费信息错误"),

    EDIT_PAY_SUCCESS(19,"编辑学生缴费信息成功"),

    LOG_CLAZZ_ERROR(16,"录入班级信息错误"),

    LOG_CLAZZ_SUCCESS(17,"录入班级信息成功"),

    EDIT_CLAZZ_ERROR(18,"编辑班级信息错误"),

    EDIT_CLAZZ_SUCCESS(19,"编辑班级信息成功"),

    LOG_COURSE_ERROR(20,"录入课程信息错误"),

    LOG_COURSE_SUCCESS(21,"录入课程信息成功"),

    EDIT_COURSE_ERROR(22,"编辑课程信息错误"),

    EDIT_COURSE_SUCCESS(23,"编辑课程信息成功"),

    LOG_DESIGNCLASSCOURSE_ERROR(20,"录入班级课程信息错误"),

    LOG_DESIGNCLASSCOURSE_SUCCESS(21,"录入班级课程信息成功"),

    EDIT_DESIGNCLASSCOURSE_ERROR(22,"编辑班级课程信息错误"),

    EDIT_DESIGNCLASSCOURSE_SUCCESS(23,"编辑班级课程信息成功"),
    ;
    private Integer code;
    private String message;

    SysInfoEnum(Integer code, String message) {
        this.code = code;
        this.message = message;
    }


   public static SysInfoEnum success(String name){
        for(SysInfoEnum sysInfoEnum : SysInfoEnum.values()){
            if (sysInfoEnum.name().contains(name)
                    && sysInfoEnum.name().contains("EDIT")
                    && sysInfoEnum.name().contains("SUCCESS")){
                return sysInfoEnum;
            }
        }
        return SysInfoEnum.SUCCESS;
   }


    public static SysInfoEnum error(String name) {
        for(SysInfoEnum sysInfoEnum : SysInfoEnum.values()){
            if (sysInfoEnum.name().contains(name)
                    && sysInfoEnum.name().contains("EDIT")
                    && sysInfoEnum.name().contains("ERROR")){
                return sysInfoEnum;
            }
        }
        return SysInfoEnum.ERROR;
    }

    public static SysInfoEnum addSuccess(String name){
        for(SysInfoEnum sysInfoEnum : SysInfoEnum.values()){
            if (sysInfoEnum.name().contains(name)
                    && sysInfoEnum.name().contains("LOG")
                    && sysInfoEnum.name().contains("SUCCESS")){
                return sysInfoEnum;
            }
        }
        return SysInfoEnum.SUCCESS;
    }


    public static SysInfoEnum addError(String name) {
        for(SysInfoEnum sysInfoEnum : SysInfoEnum.values()){
            if (sysInfoEnum.name().contains(name)
                    && sysInfoEnum.name().contains("LOG")
                    && sysInfoEnum.name().contains("ERROR")){
                return sysInfoEnum;
            }
        }
        return SysInfoEnum.ERROR;
    }

}
